package com.zmq.pic.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * 角色 entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_role")
public class PicRole extends com.zmq.pic.entity.BaseEntity implements
		java.io.Serializable {

	private static final long serialVersionUID = -7497226566687871316L;
	// Fields

	private Long id;
	/**
	 * 角色名称
	 */
	private String roleName;
	private Set<PicRoleMenu> picRoleMenus = new HashSet<PicRoleMenu>(0);
	private Set<PicUserRole> picUserRoles = new HashSet<PicUserRole>(0);

	// Constructors

	/** default constructor */
	public PicRole() {
	}

	/** full constructor */
	public PicRole(String roleName, Set<PicRoleMenu> picRoleMenus,
			Set<PicUserRole> picUserRoles) {
		this.roleName = roleName;
		this.picRoleMenus = picRoleMenus;
		this.picUserRoles = picUserRoles;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "ROLE_NAME", length = 64)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picRole")
	public Set<PicRoleMenu> getPicRoleMenus() {
		return this.picRoleMenus;
	}

	public void setPicRoleMenus(Set<PicRoleMenu> picRoleMenus) {
		this.picRoleMenus = picRoleMenus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picRole")
	public Set<PicUserRole> getPicUserRoles() {
		return this.picUserRoles;
	}

	public void setPicUserRoles(Set<PicUserRole> picUserRoles) {
		this.picUserRoles = picUserRoles;
	}

	@Override
	public String toString() {
		return "PicRole [id=" + id + ", picRoleMenus=" + picRoleMenus
				+ ", picUserRoles=" + picUserRoles + ", roleName=" + roleName
				+ "]";
	}
	

}